updating oE console_colors

console_colors

include graphics.e 
namespace graphics 
public function console_colors(sequence colorset = {}) 

sets the codes for the colors used in text_color and bk_color.

Parameters:
  1. colorset : A sequence in one of two formats.
    1. Containing two sets of exactly sixteen color numbers in which the first set are foreground (text) colors and the other set are background colors.
    2. Containing a set of exactly sixteen color numbers. These are to be applied to both foreground and background.
Returns:

A sequence: This contains two sets of sixteen color values currently in use for foreground and background respectively.

Comments:
  • If the colorset is omitted then this just returns the current values without changing anything.
  • A color set contains sixteen values. You can access the color value for a specific color by using [X + 1] where 'X' is one of the Euphoria color constants such as RED or BLUE.
  • This can be used to change the meaning of the standard color codes for some consoles that are not using standard values. For example, the Unix default color value for RED is 1 and BLUE is 4, but you might need this to swapped. See code Example 1. Another use might be to suppress highlighted (bold) colors. See code Example 2.
Example 1:
sequence cs 
cs = console_colors() -- Get the current FG and BG color values. 
cs[FGSET][RED + 1] = 4 -- set RED to 4 
cs[FGSET][BLUE + 1] = 1 -- set BLUE to 1 
cs[BGSET][RED + 1] = 4 -- set RED to 4 
cs[BGSET][BLUE + 1] = 1 -- set BLUE to 1 
console_colors(cs) 
Example 2:
-- Prevent highlighted background colors 
sequence cs 
cs = console_colors() 
for i = GRAY + 1 to BRIGHT_WHITE + 1 do 
   cs[BGSET][i] = cs[BGSET][i - 8] 
end for 
console_colors(cs) 
See Also:

text_color bk_color

Not Categorized, Please Help

Search



Quick Links

User menu

Not signed in.

Misc Menu